home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7783 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.9 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: [Perf:] mem*() procs vs. array looping
  5. Date: Wed, 28 Feb 96 20:03:43 GMT
  6. Organization: none
  7. Message-ID: <825537823snz@genesis.demon.co.uk>
  8. References: <4glkq1$gu7@gazette.tandem.com> <4h1n14$3b3@news.interpath.net>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <4h1n14$3b3@news.interpath.net>
  15.            softbase@mercury.interpath.net
  16.            "Scott McMahan - Softbase Systems" writes:
  17.  
  18. >4. I had a program where memset was THE bottleneck, taking up more time
  19. >than I/O. I re-wrote a memory zeroing function using the most unrolled,
  20. >efficient loop I could write, and it was still orders of magnitude
  21. >slower than the system memset.  No way I could make it faster in C.
  22. >
  23. >5. WRT #4, I removed the memset. It was initializing a buffer, and I
  24. >said "forget it" and used the uninitialized buffer and took my chances.
  25.  
  26. What you are suggesting is that you deliberately broke the code. What you
  27. should have done is analyse the need for zeroing the buffer. That the
  28. code still worked after the change implies that the zeroing was either
  29. not necessary or you were depending on the memory allocated to you
  30. being zeroed to start with. memset is unlikely to be a bottleneck unless
  31. it is used repeatedly and extensively. In that case it is unlikely that
  32. you would get such a guarantee and you were using it inappropriately
  33. in the first place.
  34.  
  35. >Changing the design was more effecient than coding hokey
  36. >optimizations!
  37.  
  38. That is usually true but what you describe above is a 'hokey optimization',
  39. not a change of design.
  40.  
  41. -- 
  42. -----------------------------------------
  43. Lawrence Kirby | fred@genesis.demon.co.uk
  44. Wilts, England | 70734.126@compuserve.com
  45. -----------------------------------------
  46.